#include"udpserver.hpp"
#include"log.hpp"
#include"dict.hpp"
#include<memory>
using namespace dict_ns;
void usage(std::string str)
{
    std::cout<<"usage: "<<str<<" server_port"<<std::endl;
}
int main(int argc,char* argv[])
{
    if(argc != 2)
    {
        usage(argv[0]);
        exit(USAGE_ERROR);
    }
    EnableScrean();//在屏幕上打印日志
    dict _dict;
    uint16_t server_port = std::stoi(argv[1]);
    std::unique_ptr<udpserver> server_ptr = std::make_unique<udpserver>(server_port,\
    std::bind(&dict::translate,&_dict,std::placeholders::_1,std::placeholders::_2));
    server_ptr->init_server();
    server_ptr->start();
    return 0;
}